{include file='header'/}
<body>
<form class="layui-form" action="javascript:;">
    <div class="mainBox">
        <div class="main-container">
            <div class="layui-form-item">
                <label class="layui-form-label required">分组名称</label>
                <div class="layui-input-block">
                    <input type="text" id="title" name="title" lay-verify="required" autocomplete="off"
                           placeholder="请输入分组名称" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">备注</label>
                <div class="layui-input-block">
                    <textarea name="desc" class="layui-textarea"></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-block">
                    <input type="radio" name="status" value="1" title="启用" checked>
                    <input type="radio" name="status" value="0" title="禁用">
                </div>
            </div>

        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="data-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
{include file='footer'/}
<script>
  layui.use(['form', 'jquery'], function () {
    let form = layui.form;
    let $ = layui.jquery;

    layui.form.on("submit(data-save)", function (data) {
      layui.$.ajax({
        url: "{:url('linksGroup/add')}",
        type: "POST",
        dateType: "json",
        data: data.field,
        success: function (res) {
          if (res.code !== 200) {
            return hui_msg(res.msg, 2);
          }
          hui_msg(res.msg, 1, function () {
            var pageId = parent.layer.getFrameIndex(window.name);
            parent.layer.close(pageId);
          });
        }
      });
      return false;
    })

  })
</script>
</body>
</html>
